Right after the Spanish-American War in 1898, the US acquired the Philippines from Spain. At that time, local leaders desired Philippine independence. The Philippine - American War was fought around 1899 - 1902, during which the US put down this quest for freedom and the Philippines was still US property at the time of the Pearl Harbor attack. However, if the US had granted the Philippines independence back in 1901, would Japan still have felt the need to go to war?
As mentioned in this Wikipedia article, Japan's reasons for attacking the US were mostly because of the US stopping oil and other material shipments to Japan and Japanese belief that further Japanese aggression in Asia (which they were intent on pursuing and not just or even primarily in Philippines) would lead to a war with the US anyway. Thus Japan attacked Pearl Harbor to gain the advantage of surprise.
So no, Philippine independence had nothing to do with Japan attacking Pearl Harbor and Japan would probably have gone to war anyway.
Japan did not attack the US because of the oil embargo. They went to war, in part, because of the oil embargo. But their most important territorial objective was the Dutch East Indies, with their oilfields.
The Japanese chose to attack the US, rather than just the European colonial powers, because the Philippines would have been a bone in their throat in the event that America intervened in a Japanese-Allied confrontation:
The entire Japanese strategic concept for a war against the US would have been undermined if the Pacific Fleet could base safely at Manila. They depended on an extended series of harrying attacks to wear down the numerically superior US battle line on the long voyage into Japanese-held waters for the decisive battle.
Large areas of the Empire, including Formosa which was practically one of the Home Islands by that point, were within range of heavy bombers on Luzon.
The Japanese reasoning (if you can call it that) for attacking the US would still have held, if the independent Philippine government had not been reliably pro-Axis. A neutral Philippines probably would have gone the way of neutral Norway.
In early 1942, at the behest of the Philippines' Manuel Quezon, the United States offered to accelerate the independence of the Philippines (scheduled for 1946) and leave immediately, if Japan would also leave country, thereby "neutralizing" it. Japan did not accept because its troops were already "on the ground."
There were two reasons why. First, the Philippines were a key "stop" on the way "south" (to the East Indies (modern Indonesia), and ultimately, Australia.
The second was that Japan was opposed to the presence of a U.S. fleet ANYWHERE in the Pacific. Neutralizing the Philippines wouldn't have resolved this issue. It would just have given Japan one less base from which to operate.
Source: James MacGregor Burns, "Roosevelt: The Soldier of Freedom"
Hypotheticals belong to what is known as speculative history or allohistory, sometimes as alternate history.
To substantiate a hypothetical you need a theory of causation.
"However, if the US had granted the Philippines independence back in 1901, would Japan still have felt the need to go to war?"
This question asserts that the Empire of Japan went to war with the United States because of US control over the Philippines. Such a causal theory in actuality is demonstrably false. The immediate cause of the war was the presence of a culminating battle grand strategy in the Imperial Japanese Navy combined with the United States immediately hostile behaviour towards Japanese Imperialism in China and the colonies of France, The United Kingdom and Holland.
The intermediate cause of the war between Japan and the United States was competing imperial and neo-imperial interests, mainly voiced over the division of China's economy. Particularly due to the Showa racialist ideology in Japan and the export of Christian liberal-democratic ideology in the United States. (A world-systems / Marxist Imperialist analysis of cause, fairly solid at this level of analysis).
The final cause of the war was the Imperialist stage of capitalism, the development of neo-colonial economics in the United States involving loosely held colonies under nominal self-governance (or development to the same), and the racialist ideology of post-Restoration Japan and the increasing power of the networks of Trusts in the United States and their international imperial ambitions rooted in the Gilded Age.
So no, changing the formal nature of US control over the Philippines in 1901 would not change the conflict of interests between the emerging Showa racialist ideology and US liberalist neo-colonialism. However, it may "butterfly" the specifics of war between Japan and the United States, particularly if Japanese and US imperialist interests can be united against some other force in the area, particularly if the Trusts of the United States gain an interest in seeing Japanese control over China.