I've wondered this for a long time but was unsuccessful in finding my answers online. If there were too many casualties in a battle would soldiers be ordered to take cover before falling back? Was there a point in the war where taking cover seemed smarter than doing line battles that caused massive deaths?
At around what decade did line battling cease to exist in military combat?
OP’s question makes sense, and I think I understand it, but to get a digestible answer out there, it would probably help to lay out a few tactical definitions.
By “line battling” I believe OP is referring to a traditional double-rank battle line infantry formation, which sees the soldiers marching at least two rows deep, shoulder-to-shoulder towards an enemy position. Many of these tactics came from William J. Hardee’s ‘Rifle and Light Infantry Tactics’ published in 1855, which served as the basis for much of the instruction for American Civil War infantry officers. This text, along with Winfield Scott’s ‘Infantry Tactics’ stressed the importance of massed fire to drive away enemy combatants from a fixed position. The idea was that muskets or rifles could be best put to use when their admittedly poor accuracy was concentrated and delivered with overwhelming force. Even rifled barrels delivering bullets instead of musket balls couldn’t be counted on to hit much beyond 50 yards when the smoke of artillery and black powder obscured a battlefield.
So there’s this very reasonable, practical, well-tested tactic in the Civil War that sees armies massing their infantry, getting right up to an enemy position, and pouring wave after wave of rifle fire into a position. It seems crazy to modern observers, but in reality, this really was the best way to use rifle fire effectively against a massed enemy. To answer OP’s question about when these armies realized that fighting from a concealed or covered position was deemed more desirable than marching in the open: in a word, immediately. Almost any soldier of the period, if given the opportunity, immediately started digging into a position or creating makeshift fortifications so they could fire from a concealed position. Naturally, this was only if they were on the defensive; if a soldier had to take an enemy position, there was no digging in that could be done, and you’d march up, mass your fire, and try to drive the defenders off.
With any luck, artillery fire from behind your own lines would soften the defenders up before you got up to their works, but in the Civil War, to make the best use of infantry fire, you had to mass it. The accuracy of the rifles and poor visibility on the battlefield necessitated this.
One breakthrough that did occur in this regard was made during Grant’s push south in 1864. A young Major named Emory Upton developed a tactic that was literally a half century ahead of its time (it would be put to use widely in World War I). Upton was in Grant’s army when they faced Lee at the Battle of Spotsylvania Courthouse, and the guy knew a thing or two about fighting in that era. He was a veteran of the Seven Days, Fredericksburg, Antietam, and Gettysburg (to name just a few of the big ones), so he’d seen practically every evolution of tactics throughout the war. When he got to Spotsylvania, he saw that Lee’s troops were dug in hard at a spot called “The Mule Shoe,” much like the trench warfare of WW1 (trenches, obstacles, converging fields of fire). He had a revelation: why not just run towards the enemy lines, wait to fire until right on top of them, then just pour into the enemy trenches, creating a breach that can be exploited for following units.
It was a tactical revolution for infantry tactics. Massed fire was still used, but the approach to a position, and the follow up after unleashing a sheet of fire, changed. Instead of marching in double-rank battle line and exchanging fire with an enemy (trading shots from an exposed position while your enemy huddles behind concealment), you run up, hit them with a hard volley, then go to the bayonet. After some fits and starts, the tactic became the go-to strategy for infantry formations going forward, and did indeed represent a true breakthrough in tactics that eventually moved armies away from the battle line formation when conducting offensive operations.
You can read more about Upton in Bruce Catton’s ‘A Stillness At Appomattox’ and ‘Grant Takes Command’ or more briefly in James McPherson’s ‘Battle Cry of Freedom.’
There isn't a definitive point where cover became the standard, but it was consistently used throughout the entirety of the war. The concept of massed soldiers in open fields firing into each others' lines really wasn't as common as it might seem. More often, one side fixed its position, and the other side attempted assaults on that position. In virtually every "fixed" position, soldiers used whatever was available to entrench or protect themselves. No one ever just stood openly on top of a hill if they had a fence, or rocks, or literally anything they could conceal themselves behind. Even in many early battles we see the use of cover as defense. Shiloh, April 6, 1862, as the Confederate push drives Union forces back, a contingent found natural cover in a creek bed to the center of the line, and used it to devastating advantage. This area, that would become known as the "Hornet's Nest" was a naturally defensible position, but only if the men were actually hunkered down behind cover. It took hours, dozens of cannons, and multiple units converging on the position to finally eliminate it. Most historians would agree the Hornet's Nest was crucial in slowing the Confederate advance enough that Grant's Army wasn't completely used up by the end of the first day.
Again, in nearly every major battle: Fredericksburg (December 1862)-Confederates concealed and protected behind a stonewall on one side, and trenches on the other, are assaulted from across an open field by Union soldiers. Weeks later at Stones River/Murfreesboro, the reverse is the case. In one grisly section that became known as "Hell's Half Acre," Confederates tried to dislodge Union soldiers from natural limestone trenches. See: https://imgur.com/a/rmhxJiH I've included several images from the war as well as some of my own to illustrate the levels of cover used in certain places. It is by no means all the examples.
Essentially, soldiers used whatever worked, whenever it was available, whenever it suited them tactically. In open areas with little to no cover, like at Perryville, KY, armies move and fight in the open. But nearly any time there was good cover, in a good position, they stayed there and forced the enemy to drive them out. (This was even the reasoning/explanation for why at Gettysburg, Union General Sickles moved away from Little Round Top toward Devil's Den and the Peach Orchard area-he thought it was a better place to defend, and turned out to be wrong.) The fighting in and around Little Round Top proved this rule, as Confederates were unable to dislodge the 20th Maine, among other units. And of course, on Cemetery Ridge, Pickett's Charge may very well have gone quite differently had Union forces not had at least part of that stone wall in front of them (last image in album).
By the spring of 1864, it had become the SOP to dig in wherever possible and erect battlements. Fencerows, bricks, dirt, logs, etc. were all useful. The only places this isn't really helpful, is when the terrain itself is already difficult to fight in, like the Wilderness in May 1864 or at Chickamauga in September 1863. Grant's campaign in the spring of '64 is marked by soldiers digging in defensively and forcing the enemy to attack. The same is the case with Joe Johnston's attempts to slow Sherman from Chattanooga to Atlanta in the same year. In his case, Sherman outflanked him *instead* of attacking directly, and when he did attack directly, at Kennesaw Mountain, it was a bloody repulse.
So it would seem that by 1864, both sides realized how the war is to be fought now, but that's not exactly the case. There had always been officers who favored defensive fighting, and those who favored the offense even when it seemed suicidal to continue in that manner. Case in point: in November 1864, John Bell Hood launched a full frontal assault against a fixed Union position that nearly destroyed his entire army. Sadly, this mentality does not die in the Civil War. Even well into the second World War and even in a few places in Korea, the "hey diddle-diddle, straight up the middle" approach was still used to devastating effect on the attacking force.
TL:DR There is no single point where they stop standing up in rows to kill each other in open fields, but were using cover whenever they could even early in the war. As casualties mounted and new weaponry was employed, they consistently favored cover more and more by 1864, but still deployed the open maneuvering when necessary.